import {requests, type MyResponse} from "@/api/request";
import { Article } from "@/class/Article";

export const reqGetArticleList =()=>requests({
    url:"/article/list",
})
export const reqGetArticle =(id:string)=>requests<Article>({
    url:"/article/information",
    params:{id},
})

export const reqAddArticleFromCkeditor = (article:Article)=>requests({
    url:"article/ckeditor5",
    method:"post",
    data:article,
})

export const reqAddArticleFromWangEditor = (article:Article)=>requests<Object>({
    url:"article/wangeditor",
    method:"post",
    data:article,
})
export const reqDeleteArticleByCkeditor = (article:Article)=>requests({
    url:"article/ckeditor5",
    method:"delete",
    data:article,
})
export const reqDeleteArticleByWangEditor = (articleId:string)=>requests<string>({
    url:"article/wangeditor",
    method:"delete",
    data:articleId,
})
export const reqGetArticleId = ()=>requests<string>({
    url:"article/id",
    method:"GET",
})

export const reqGetArticleCount = ()=>requests({
    url:"article/findAll",
    method:"GET",
})

export const reqGetArticleByPage =(currentPage:number,pageSize:number)=>requests<Article[]>({
    url:`article/getArticleByPage?currentPage=${currentPage}&pageSize=${pageSize}`,
    method:"GET",
})
export const reqGetArticleText = (data:any)=>requests({
    url:`article/text?text=${data}`,
})
export const reqUploadFile2ArticleUrl='/api/file/upload2/articlebywangeditor';